﻿@model WeProjectsModel.News
<style type="text/css">
    section.container form > div {
        margin-top: 10px;
        margin-bottom: 10px;
    }
</style>

@{
    List<WeProjectsModel.Tag> tags = ViewBag.Tags;
}

@{
    ViewBag.Title = "Create";
}
@Html.Partial("_projectMenu")
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<script type="text/javascript" charset="utf-8" src="lang/zh-cn/zh-cn.js"></script>
     
    <h2> @ViewBag.projectTitle > 发布新闻</h2>

@using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)
    <input type="hidden" name="ProjectID" value="@Html.ViewContext.RouteData.Values["id"]" />
    <div>
        <input type="text" name="Title" id="Title" class="text-box" />
        @Html.ValidationMessageFor(model => model.Title)
    </div>
    <div class="marginL-20p">
        @foreach (var c in tags)
        {
            <label class="checkbox">
                <input type="checkbox" name="tags" value="@c.Code"> @c.Name
            </label>
        }
    </div>
    <div>
        <script id="editor" type="text/plain" style="width:100%;height:300px;">
        </script>
        <input type="hidden" id="NewsContent" name="NewsContent" />
    </div>
@*<table class="gridtable">
    <tr><td style="background-color: #dedede; width: 10%;">标题</td>
<td><input type="hidden" name="ProjectID" value="@Html.ViewContext.RouteData.Values["id"]" />
        <input type="text" name="Title" id="Title"/>
@Html.ValidationMessageFor(model => model.Title)</td>
</tr>
    <tr><td style="background-color: #dedede; width: 10%;">标签</td><td>
        @foreach (var c in tags)
{
    <label class="checkbox">
        <input type="checkbox" name="tags" value="@c.Code"> @c.Name
    </label>
        }
        </td></tr>
    <tr><td style="background-color: #dedede; width: 10%;">正文</td>
<td>
<script id="editor" type="text/plain" style="width:100%;height:300px;"></script>
        <input type="hidden" id="NewsContent" name="NewsContent" />
</td></tr>
</table>*@
     <div class="text-center">
         <input type="submit" value="发布" class="btn btn-success" />
    </div>
    }
<script src="~/Scripts/jquery-1.8.2.js"></script>
<script type="text/javascript">
    var ue = UE.getEditor('editor');
    $('form').submit(function () {
     $('#NewsContent').val(ue.getContent());
    });
</script>

    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
